library(R2jags)
library(rjags)
library(foreign)
#install.packages("data.table", dep=TRUE)
library(data.table)
#install.packages("xtable", dep=TRUE)
library(xtable)

setwd("c:/users/james/desktop/dropbox/transparency_and_democracy/transparencyindex/PAReplicationMaterials/Index Properties/")

load("TransparencyIndex2013.Rdata")

print(results)

output <- results$BUGSoutput$summary

#Assess the highest Rhat value

Rhat.max <- data.table(output, key="Rhat")

#Output for printing

output.necessary <- as.matrix(output[,c('Rhat')])

output.to.print <- xtable(output.necessary, caption="Gelman-Rubin Convergence Statistics")

sink("ConvergeStats.tex")

output.to.print

